package com.vincent.message;

import com.vincent.common.Message;
import com.vincent.common.MessageType;
import com.vincent.utils.BallotNumber;

/**
 * Created by wensen on 2016/12/7.
 * Sent by Scouts to Acceptors in Phase 1 of Paxos.
 * Carries a ballot number.
 **/
public class P1aMessage extends Message {

//    private final int src;
    private final BallotNumber ballot_number;

    public P1aMessage(int src, BallotNumber ballot_number) {
        super(src);
        this.ballot_number = ballot_number;
    }

    public BallotNumber ballot_number() {
        return this.ballot_number;
    }

    public int messageType(){
        return MessageType.P1A_MESSAGE;
    }

    public String toString() {
        return "{src: " + this.src() +
                " ballot: " + this.ballot_number + "}";
    }
}
